import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createBy'
   },
   {
    title: '创建日期',
    align:"center",
    dataIndex: 'createTime'
   },
   {
    title: '叫料工位',
    align:"center",
    dataIndex: 'callingStation'
   },
   {
    title: '物料工位',
    align:"center",
    dataIndex: 'materialStation'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "创建日期",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "叫料工位",
      field: 'callingStation',
      component: 'JSearchSelect',
      componentProps:{
         dict:"pcl_jiaoliao_station"
      },
      //colProps: {span: 6},
 	},
	{
      label: "物料工位",
      field: 'materialStation',
      component: 'JSearchSelect',
      componentProps:{
         dict:"pcl_wuliao_station"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '叫料工位',
    field: 'callingStation',
    component: 'JSearchSelect',
    componentProps:{
       dict:"pcl_jiaoliao_station"
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入叫料工位!'},
          ];
     },
  },
  {
    label: '物料工位',
    field: 'materialStation',
    component: 'JSearchSelect',
    componentProps:{
       dict:"pcl_wuliao_station"
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入物料工位!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  createBy: {title: '创建人',order: 0,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 1,view: 'datetime', type: 'string',},
  callingStation: {title: '叫料工位',order: 2,view: 'sel_search', type: 'string',dictCode: 'pcl_jiaoliao_station',},
  materialStation: {title: '物料工位',order: 3,view: 'sel_search', type: 'string',dictCode: 'pcl_wuliao_station',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}